package com.pjb.springsecurity.mapper;

import com.pjb.springsecurity.domain.entity.Weather;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface WeatherMapper {
    @Insert("insert into weather(temperature,time,city) values (#{temperature},#{time},#{city})")
    public void save(Weather weather);

    @Select("select * from weather where city = #{city}")
    public List<Weather> getWeather(String city);

    @Update("update weather set temperature = #{temperature} , time = #{time} where id = #{id}")
    public void updateWeather(Weather weather);
}
